<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    section {
      width: 500px;
    }

    ul {
      display: flex;
      justify-content: space-around;
      align-items: center;
      list-style-type: none;
      width: 100%;
      height: 50px;
      background-color: orange;
      color: #ffffff;
    }

    ul li {
      display: flex;
      align-items: center;
      cursor: pointer;
      height: 100%;
      padding: 0 10px;
    }

    .tab-item {
      width: 100%;
      height: 600px;
      background-color: #ccc;
    }
    .active{
      background-color: red;

    }
  </style>
</head>

<body>
  <div id="app">
    <section>
      <ul>
        <li class="tab-tabs" v-for="(tab,index) in tabs" :key="index" :class="{active:currentIndex===index}" @click="currentIndex=index">{{tab}}</li>
      </ul>
      <div class="tab-item" v-if="currentIndex===0">首页</div>
      <div class="tab-item" v-else-if="currentIndex===1">登录页</div>
      <div class="tab-item" v-else>购物车</div>
    </section>
  </div>
  <script src="../../javascript//vue.js"></script>
  <script>
    const vm = new Vue({
      el: "#app",
      data() {
        return {
          tabs: ["首页", "登录页", "购物车"],
          currentIndex: 0
        }
      }
    })
  </script>
</body>

</html>